package speed2010.matcher.gui.panels;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;

import javax.swing.JPanel;

public class ImagePanel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8539351989996830911L;

	Image img;

	public ImagePanel(String imagePath)
	{	
		this.img = Toolkit.getDefaultToolkit().getImage(imagePath);
		this.setBackground(Color.WHITE);
	}
	

	public void paintComponent(Graphics g) {
		super.paintComponent(g);		
		
		int h = this.getSize().width / 2;
		int h2 = img.getWidth(null) / 2;
		
		g.drawImage(img, h - h2, 0, this);
	}

}
